package vn.gq.tym.scr;

import vn.gq.tym.widget.ITabHost;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.actionbarsherlock.app.SherlockFragment;

public abstract class BaseFragment extends SherlockFragment {

	protected View convertView;
	
	protected abstract int getLayoutId();
	
	protected abstract int getContainerId();
	
	protected abstract void createView();
	
	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {
		convertView = inflater.inflate(getLayoutId(), container, false);
		createView();
		return convertView;
	}
	
	protected View findViewById(int id) {
		View v = convertView.findViewById(id);
		return v;
	}

	@Override
	public void onResume() {
		super.onResume();
		if (getActivity() instanceof ITabHost)
			((ITabHost) getActivity()).setCurrentFragment(this);
	}

}
